#pragma once
#pragma warning(disable:4996)       // disable checked iterator errors http://msdn.microsoft.com/en-us/library/aa985965(VS.80).aspx 

//
// Copyright (C) 2011 Steve Channell steve.channell@cepheis.com
//
// This file is part of Cephei.QL, an open-source library wrapper 
// arround QuantLib http://quantlib.org/
//
// Cephei.QL is open source software: you can redistribute it and/or modify it
// under the terms of the license.  You should have received a
// copy of the license along with this program; if not, please email
// <support@cepheis.com>. The license is also available online at
// <http://cepheis.com/license.htm>.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE.  See the license for more details.
//
// Version 2.101

#include <Macros.h>
#include <CoVector.h>
#include <CoMatrix.h>
#include <CoCube.h>
#include <ValueHelpers.h>
#include <Settings.h>

#include <gen/QL/Models/Marketmodels/Callability/MarketModelNodeDataProvider.h>
#include <gen/QL/Methods/Montecarlo/ParametricExercise.h>
#pragma unmanaged 
#include <ql\models\marketmodels\callability\marketmodelparametricexercise.hpp>
#include <boost/smart_ptr/detail/spinlock.hpp>
#pragma managed 

using namespace System;
using namespace QuantLib;
using namespace Cephei;

using namespace Cephei::QL::Models::Marketmodels;
using namespace Cephei::QL::Methods::Montecarlo;
#undef HANDLE
#define ABSTRACT
#undef STRUCT
namespace Cephei { namespace QL { namespace Models { namespace Marketmodels { namespace Callability {
	//////////////////////////////////////////////////////////////////////////////////////////////
	// implementation of IMarketModelParametricExercise
	public ref class CMarketModelParametricExercise : 
            public CMarketModelNodeDataProvider,
            public Cephei::QL::Models::Marketmodels::Callability::IMarketModelParametricExercise
	{
	protected: 
		boost::shared_ptr<QuantLib::MarketModelParametricExercise>* _ppMarketModelParametricExercise;
#ifdef HANDLE
		QuantLib::Handle<QuantLib::MarketModelParametricExercise>* _phMarketModelParametricExercise;
#endif
		Object^ _MarketModelParametricExerciseOwner;     // reference to object that manages the storage for this object
	internal:
        CMarketModelParametricExercise (boost::shared_ptr<QuantLib::MarketModelParametricExercise>& childNative, Object^ owner);
        CMarketModelParametricExercise (QuantLib::MarketModelParametricExercise& childNative, Object^ owner);
        CMarketModelParametricExercise (CMarketModelParametricExercise^ copy);
        CMarketModelParametricExercise (System::Type^ t);
#ifdef STRUCT
        CMarketModelParametricExercise (QuantLib::MarketModelParametricExercise childNative);
#endif       
#ifdef HANDLE
		CMarketModelParametricExercise (QuantLib::Handle<QuantLib::MarketModelParametricExercise>& childNative, Object^ owner);
		CMarketModelParametricExercise (QuantLib::Handle<QuantLib::MarketModelParametricExercise> childNative);
#endif
		virtual ~CMarketModelParametricExercise ();
		!CMarketModelParametricExercise ();

	internal:
		QuantLib::MarketModelParametricExercise& GetReference ();
		boost::shared_ptr<QuantLib::MarketModelParametricExercise>& GetShared ();
		QuantLib::MarketModelParametricExercise* GetPointer ();
        void SetMarketModelParametricExercise (boost::shared_ptr<QuantLib::MarketModelParametricExercise> native)
        {
            if (_ppMarketModelParametricExercise != NULL)
                delete _ppMarketModelParametricExercise;
            _ppMarketModelParametricExercise = new boost::shared_ptr<QuantLib::MarketModelParametricExercise> (native);
            SetMarketModelNodeDataProvider (boost::dynamic_pointer_cast<QuantLib::MarketModelNodeDataProvider> (*_ppMarketModelParametricExercise));
        }
#ifdef HANDLE
		QuantLib::Handle<QuantLib::MarketModelParametricExercise>& GetHandle ();
#endif
		virtual bool HasNative () override;
    public:
        property Cephei::IVector<UInt64>^ NumberOfData 
        {
		    virtual Cephei::IVector<UInt64>^ get () ;
        }
    private:
        Cephei::QL::Methods::Montecarlo::CParametricExercise^ _ParametricExercise;
    private:
        property CParametricExercise^ ParametricExercise
        {
            CParametricExercise^ get ()
            {
                if (_ParametricExercise == nullptr)
                {
                    _ParametricExercise = gcnew CParametricExercise (boost::dynamic_pointer_cast<QuantLib::ParametricExercise> (*_ppMarketModelParametricExercise), this);
                }
                return _ParametricExercise;
            }
        }
    public:
        operator Cephei::QL::Methods::Montecarlo::IParametricExercise^ ()
        {
            return static_cast<Cephei::QL::Methods::Montecarlo::IParametricExercise^>(ParametricExercise);
        }
        operator Cephei::QL::Methods::Montecarlo::CParametricExercise^ ()
        {
            return ParametricExercise;
        }
        
    public:
        virtual Boolean M1417_3550 (UInt64 exerciseNumber, Cephei::IVector<Double>^ parameters, Cephei::IVector<Double>^ variables) = Cephei::QL::Methods::Montecarlo::IParametricExercise::Exercise
        {
            return static_cast<Cephei::QL::Methods::Montecarlo::IParametricExercise^>(ParametricExercise)->Exercise ( exerciseNumber,  parameters,  variables);
        }
        virtual Cephei::QL::Methods::Montecarlo::IParametricExercise^ M1417_3551 (UInt64 exerciseNumber, Cephei::IVector<Double>^ parameters) = Cephei::QL::Methods::Montecarlo::IParametricExercise::Guess
        {
            return static_cast<Cephei::QL::Methods::Montecarlo::IParametricExercise^>(ParametricExercise)->Guess ( exerciseNumber,  parameters);
        }
        property Cephei::IVector<UInt64>^ M1417_3552 
        {
            virtual Cephei::IVector<UInt64>^ get () = Cephei::QL::Methods::Montecarlo::IParametricExercise::NumberOfParameters::get
            {
                return static_cast<Cephei::QL::Methods::Montecarlo::IParametricExercise^>(ParametricExercise)->NumberOfParameters;
            }
        }
        property Cephei::IVector<UInt64>^ M1417_3553 
        {
            virtual Cephei::IVector<UInt64>^ get () = Cephei::QL::Methods::Montecarlo::IParametricExercise::NumberOfVariables::get
            {
                return static_cast<Cephei::QL::Methods::Montecarlo::IParametricExercise^>(ParametricExercise)->NumberOfVariables;
            }
        }
    };
	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Factory class
	public ref class CMarketModelParametricExercise_Factory : public System::MarshalByRefObject,  public IMarketModelParametricExercise_Factory
	{
	public:
    };
   
/*Cephei*/ } /*QL*/ } /*Models*/ } /*Marketmodels*/ } /*Callability */}
